package www.superbytecode.com.util;

import org.apache.commons.lang3.StringUtils;

import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * All rights Reserved, Designed By www.super-bytecode.com
 *
 * @ProjectName superbytecode-builder
 * @Package www.superbytecode.com.util
 * @ClassName TextUtil
 * @Description
 * @Author [Lance Ting]
 * @Date 2020/7/14 20:37
 * @Version V1.0
 * @Copyright: 2020 www.super-bytecode.com Inc. All rights reserved.
 * @TODO：本文件Lance Ting所作, 如果转载或使用请标明具体出处!
 **/
public class TextUtil extends StringUtils {
    
    public static boolean isTrue(String s) {
        return "true".equalsIgnoreCase(s); //$NON-NLS-1$
    }

    public static String dbStringToCamelStyle(String str) {
        if (str != null) {
            StringBuilder sb = new StringBuilder();
            sb.append(String.valueOf(str.charAt(0)).toUpperCase());
            return getString(str, sb);
        }
        return null;
    }

    private static String getString(String str, StringBuilder sb) {
        for (int i = 1; i < str.length(); i++) {
            char c = str.charAt(i);
            if (c != '_') {
                sb.append(c);
            } else {
                if (i + 1 < str.length()) {
                    sb.append(String.valueOf(str.charAt(i + 1)).toUpperCase());
                    i++;
                }
            }
        }
        return sb.toString();
    }

    private static boolean isNeedChange(String content) {
        return content.contains("_");
    }

}